package com.suixun.service.credits.impl;

import java.util.List;

import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.google.common.collect.Lists;
import com.suixun.dao.PutAreaMapper;
import com.suixun.dao.credits.PutAreaDao;
import com.suixun.entity.ext.credits.company.PutAreaShow;
import com.suixun.service.credits.PutAreaService;
import com.suixun.vo.credits.PutAreaShowVo;

/**
 * 商品投放区域
 * 
 * @author yh
 * @date 2017年12月14日
 */
@Service
public class PutAreaServiceImpl implements PutAreaService {

    @Autowired
    private PutAreaMapper putAreaMapper;
    
    @Autowired
    private PutAreaDao putAreaDao;

    @Override
    public List<PutAreaShowVo> findByArchivesId(Integer archivesId) {
        List<PutAreaShow> arealist = putAreaDao.findAreaByArchives(archivesId);
        List<PutAreaShowVo> list = Lists.newArrayList();
        if (!CollectionUtils.isEmpty(arealist)) {
            for(PutAreaShow po : arealist){
                PutAreaShowVo vo = new PutAreaShowVo(po.getAreaId(), po.getPutRange());
                vo.setAreaName(po.getAreaName());
                list.add(vo);
            }
        }
        return list;
    }

}
